Skip to content

fix: call ListTaskEntries only for directory URLs in PreheatFile/StaFile#4712

Merged
gaius-qi merged 3 commits intomainfrom
feature/preheat-file
Apr 13, 2026
Merged

fix: call ListTaskEntries only for directory URLs in PreheatFile/StaFile#4712
gaius-qi merged 3 commits intomainfrom
feature/preheat-file

Conversation

@gaius-qi
Copy link
Copy Markdown
Member

Description

This pull request refactors how directory URLs are handled in the PreheatFile and StatFile methods in scheduler/service/service_v2.go. The main focus is to streamline the initialization of the urls slice and the logic for handling directory URLs, reducing redundant code and improving clarity.

Refactoring directory URL handling:

  • Moved the initialization of the urls slice and the check for directory URLs (strings.HasSuffix(req.GetUrl(), "/")) to occur before calling ListTaskEntries in both PreheatFile and StatFile, eliminating redundant code and improving readability. [1] [2]
  • Removed duplicate declarations of the urls slice and the directory check that previously occurred after fetching task entries, further simplifying the logic flow. [1] [2]

Logging cleanup:

  • Removed a redundant log statement that reported the total number of files and peers at the end of the StatFile method, as this information is no longer necessary.

Related Issue

Motivation and Context

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

…File

Signed-off-by: Gaius <gaius.qi@gmail.com>
@gaius-qi gaius-qi added this to the v2.5.0 milestone Apr 13, 2026
@gaius-qi gaius-qi self-assigned this Apr 13, 2026
@gaius-qi gaius-qi requested review from a team as code owners April 13, 2026 10:27
@gaius-qi gaius-qi added the enhancement New feature or request label Apr 13, 2026
@gaius-qi gaius-qi enabled auto-merge (squash) April 13, 2026 10:37
mingcheng
mingcheng previously approved these changes Apr 13, 2026
Copy link
Copy Markdown
Member

@mingcheng mingcheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

BraveY
BraveY previously approved these changes Apr 13, 2026
Copy link
Copy Markdown

@BraveY BraveY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

hhhhsdxxxx
hhhhsdxxxx previously approved these changes Apr 13, 2026
chlins
chlins previously approved these changes Apr 13, 2026
Copy link
Copy Markdown
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@gaius-qi gaius-qi dismissed stale reviews from chlins, hhhhsdxxxx, BraveY, and mingcheng via 06b6a38 April 13, 2026 12:17
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 28.07%. Comparing base (9139e69) to head (06b6a38).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
scheduler/service/service_v2.go 50.00% 11 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4712      +/-   ##
==========================================
- Coverage   28.12%   28.07%   -0.05%     
==========================================
  Files         232      232              
  Lines       23097    23096       -1     
==========================================
- Hits         6495     6485      -10     
- Misses      16161    16171      +10     
+ Partials      441      440       -1     
Flag Coverage Δ
unittests 28.07% <50.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
scheduler/service/service_v2.go 40.11% <50.00%> (-0.30%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gaius-qi gaius-qi disabled auto-merge April 13, 2026 12:54
@gaius-qi gaius-qi merged commit 4726ab4 into main Apr 13, 2026
17 checks passed
@gaius-qi gaius-qi deleted the feature/preheat-file branch April 13, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants